﻿using Hidistro.UI.Common.Controls;
using JSShop.Model;
using Juse.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using Hidistro.Entities.Commodities;
using System.Data;
using Hidistro.Membership.Context;
using wnxd.javascript;


namespace Hidistro.UI.SaleSystem.Tags
{
    public class wnxd_RecommendProductxq_3q : AscxTemplatedWebControl
    {
        private int productId;
        private Repeater PList;

        protected override void AttachChildControls()
        {
            this.PList = (Repeater)this.FindControl("PList");
            if (int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                try
                {
                    aspnet_Members member = null;
                    Member m = HiContext.Current.User as Member;
                    if (m != null) member = new json(m).TryConvert(typeof(aspnet_Members)) as aspnet_Members;
                    this.PList.DataSource = new ProductBrowser().GetSameBrandProducts(member, productId, Count);
                }
                catch { this.PList.DataSource = null; }
                this.PList.DataBind();
            }
        }
        protected override void OnInit(EventArgs e)
        {
            if (this.SkinName == null)
            {
                this.SkinName = "/ascx/tags/Common_GoodsList/wnxd_RecommendProductxq_3q.ascx";
            }
            base.OnInit(e);
        }
        public int Count
        {
            get;
            set;
        }
    }
}
